﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Webdiyer.WebControls.Mvc;

public class HtmlPagerHelper
{
    public static PagerOptions BasePagerOption
    {
        get
        {
            return new PagerOptions
            {
                ContainerTagName = "div",
                PagerItemTemplate = "{0}",
                CurrentPagerItemTemplate = "<span class='current'>{0}</span>",
                DisabledPagerItemTemplate = "<span class=\"disabled\">{0}</span>",
                Id = "flickrpager"
            };
        }
    }

    public static HtmlString TrClass(int index)
    {
        if (index % 2 == 0)
            return new HtmlString("tr-double");
        else
            return new HtmlString("tr-single");
    }

    public static HtmlString ShowSelectOpton(Dictionary<string, string> dic, params string[] select_values)
    {
        StringBuilder strb = new StringBuilder();
        foreach (var item in dic)
        {
            string selected = "";
            foreach(var select_value in select_values)
            {
                if (item.Key.ToLower() == select_value.ToLower())
                    selected = "selected";
            }
            strb.AppendLine($"<option value='{item.Key}' {selected}>{item.Value}</option>");
        }
        return new HtmlString(strb.ToString());
    }
}
